import { request, config } from 'utils'
import { func } from 'prop-types';

const { api } = config
const { permissions, dictionarys, dictionaryItems, blacklists, whitelists, sensitiveWords } = api

export function getModals(params) {
  return request({
    url: permissions + '/modals',
    method: 'get',
    data: params,
  })
}

export function getDictionarys() {
  return request({
    url: dictionarys,
    method: 'get'
  })
}

export function addDictionaryItems(params) {
  return request({
    url: dictionaryItems,
    method: "post",
    data: params
  })
}

export function updateDictionaryItems(params) {
  return request({
    url: dictionaryItems,
    method: "put",
    data: params
  })
}

export function deleteDictionaryItems(params) {
  return request({
    url: dictionaryItems,
    method: "delete",
    data: params
  })
}

export function getBlacklists(params) {
  return request({
    url: blacklists,
    method: 'get',
    data: params
  })
}

export function addBlackList(params) {
  return request({
    url: blacklists,
    method: 'post',
    data: params
  })
}

export function updateBlackList(params) {
  return request({
    url: blacklists,
    method: 'put',
    data: params
  })
}

export function deleteBlackList(params) {
  return request({
    url: blacklists,
    method: 'delete',
    data: params
  })
}

export function batchDeleteBlackList(params) {
  return request({
    url: blacklists + "/batchDelete",
    method: "post",
    data: params
  })
}

export function getWhitelists(params) {
  return request({
    url: whitelists,
    method: 'get',
    data: params
  })
}

export function addWhiteList(params) {
  return request({
    url: whitelists,
    method: 'post',
    data: params
  })
}

export function deleteWhiteList(params) {
  return request({
    url: whitelists + `/?id=${params.id}`,
    method: 'delete',
  })
}

export function batchDeleteWhiteList(params) {
  return request({
    url: whitelists + '/batchDelete',
    method: 'post',
    data: params
  })
}

export function getSensitiveWords() {
  return request({
    url: sensitiveWords,
    method: 'get'
  })
}

export function addSensitiveWord(params) {
  return request({
    url: sensitiveWords,
    method: "post",
    data: params
  })
}

export function updateSensitiveWord(params) {
  return request({
    url: sensitiveWords,
    method: "put",
    data: params
  })
}

export function deleteSensitiveWord(params) {
  return request({
    url: sensitiveWords,
    method: "delete",
    data: params
  })
}

export function getButtons(params) {
  return request({
    url: permissions + '/buttons',
    method: 'get',
    data: params,
  })
}

export function getDatas(params) {
  return request({
    url: permissions + '/datas',
    method: 'get',
    data: params,
  })
}

export function addMembers(params) {
  return request({
    url: permissions + "/members",
    method: 'post',
    data: params,
  })
}

export function deleteMembers(params) {
  return request({
    url: permissions + "/members",
    method: 'delete',
    data: params,
  })
}

export function dataAuthorize(params) {
  return request({
    url: permissions + '/datas/authorize',
    method: 'post',
    data: params,
  })
}

export function buttonAuthorize(params) {
  return request({
    url: permissions + '/buttons/authorize',
    method: 'post',
    data: params,
  })
}

export function modalAuthorize(params) {
  return request({
    url: permissions + '/modals/authorize',
    method: 'post',
    data: params,
  })
}

export function remove(params) {
  return request({
    url: permissions + '/delete',
    method: 'post',
    data: params,
  })
}
